#include "options.h"
#include "engine/socket.h"
#ifdef _USE_PCAP_
#include "engine/pcap.h"
#endif
#ifdef _USE_DPDK_
#include "engine/dpdk.h"
#endif

int engine_init(void)
{
    switch(options.engine) {
    case CAPTURE_ENGINE_RECV:
        return engine_recv_init();
    case CAPTURE_ENGINE_MMAP:
        return engine_mmap_init();
#ifdef _USE_PCAP_
    case CAPTURE_ENGINE_PCAP:
        return engine_pcap_init();
#endif
#ifdef _USE_DPDK_
    case CAPTURE_ENGINE_DPDK:
        return engine_dpdk_init();
#endif
    case CAPTURE_ENGINE_UNKNOWN:
    default:
        return -1;
    }
}

int engine_loop(void)
{
    switch(options.engine) {
    case CAPTURE_ENGINE_RECV:
        return engine_recv_loop();
    case CAPTURE_ENGINE_MMAP:
        return engine_mmap_loop();
#ifdef _USE_PCAP_
    case CAPTURE_ENGINE_PCAP:
        return engine_pcap_loop();
#endif
#ifdef _USE_DPDK_
    case CAPTURE_ENGINE_DPDK:
        return engine_dpdk_loop();
#endif
    case CAPTURE_ENGINE_UNKNOWN:
    default:
        return -1;
    }
}

int engine_destory(void)
{
    switch(options.engine) {
    case CAPTURE_ENGINE_RECV:
        return engine_recv_destory();
    case CAPTURE_ENGINE_MMAP:
        return engine_mmap_destory();
#ifdef _USE_PCAP_
    case CAPTURE_ENGINE_PCAP:
        return engine_pcap_destory();
#endif
#ifdef _USE_DPDK_
    case CAPTURE_ENGINE_DPDK:
        return engine_dpdk_destory();
#endif
    case CAPTURE_ENGINE_UNKNOWN:
    default:
        return -1;
    }
}
